 function obiect_ajax() {
// Mozilla/Safari
    if (window.XMLHttpRequest) {
        obiect = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        obiect = new ActiveXObject("Microsoft.XMLHTTP");
    }
	return obiect;
} 
 
  function verificare_formular(mod) {
   if (mod == "0") {
    if (document.autentificare.utilizator.value != "")
     returnare_ajax('0');
	else 
	{
		document.getElementById('utilizator').select();
	    document.getElementById('utilizator').focus();
	}
   }
   else if (mod == "1") {
   if ((document.autentificare.utilizator.value != "")&&(document.autentificare.parola.value != ""))
    returnare_ajax('1');
   }
  }
 
  function returnare_ajax(mod) {
    cerere_ajax = obiect_ajax();
	strURL = "librarie/php/verificare_logare.php";
	if(mod == "1") {
		  param = "?utilizator="+document.autentificare.utilizator.value+"&parola="+document.autentificare.parola.value;
		  
	} else {
		  param = "?utilizator="+document.autentificare.utilizator.value+"&act=verificare";
	}	
    cerere_ajax.onreadystatechange = function() {
        if (cerere_ajax.readyState == 4) {
		if (mod == "1" && cerere_ajax.responseText == "0112")
		 {
		if (!document.autentificare.pop_up.checked)
		self.location = "index1.php";
		 else
		window.open("index1.php","SWAR","width=900,height=600,top=100,left=100,0,status=0,no-resize");
		 }
		 else 
  		document.getElementById('status').innerHTML = cerere_ajax.responseText;
		}
	}
	//cerere_ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//cerere_ajax.setRequestHeader("Content-length", param.length);
	//cerere_ajax.setRequestHeader("Connection", "close");
	cerere_ajax.open('GET', strURL+param, true);
    cerere_ajax.send('');
	}